package com.jingkong.model.dto;

import com.jingkong.model.User;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class Lambda {
    public static void main(String[] args) {
        List<User> list = new ArrayList();
        User a = new User();
        a.setId(11L);
        a.setGender(1);
        a.setEmail("a@sohu.com");
        a.setName("aa");

        User b = new User();
        b.setId(22L);
        b.setGender(0);
        b.setEmail("b@sohu.com");
        b.setName("bb");
        list.add(a);
        list.add(b);

        list.forEach(p->p.setAge(88));

        System.out.println(list);

        list.stream().forEach(p->p.setAge(77));

        System.out.println(list);

        list =list.stream().filter(p->p.getName()!=null).map((p)->{
            p.setAge(66);
            return p;
        }).collect(Collectors.toList());

        System.out.println(list);
    }

}
